use Faker\Generator as Faker;
$factory->define(Product::class, function (Faker $faker) {
return [
'amount' => $faker->randomFloat(2, 0, 10000),
'image' => $faker->image('public/storage/images',640,480, null, false),
];
});
$factory->define(App\User::class, function (Faker\Generator $faker) {
static $password;
$filepath = storage_path('avatars');
if(!File::exists($filepath)){
File::makeDirectory($filepath);
}
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'avatar' => $faker->image($filepath,400, 300)
];